<?php

namespace application\Module;

use library\Core\Db\CDbCriteria;
use application\Model\BuyingModel;
use application\Comm\Func;

class Buying
{
    public function getList($select = ['id', 'name', 'description', 'url','src','price','space'])
    {
        $criteria = new CDbCriteria();
        $criteria->select($select);
        $criteria->addEqCondition('is_del', 0);
        $criteria->addEqCondition('status', 1);
        $criteria->addOrderDesc('orderby');
        $buyingModel = new BuyingModel();
        $data = $buyingModel->getListForArray($criteria);
        if(!empty($data)){
            foreach($data as $k => $v){
                $data[$k]['src'] = Func::imgUrl($v['src']);
            }
        }
        return $data;
    }


}
